<template>
	<view>
		<u-navbar class="navbar" :border-bottom="false" title="全部评论" :title-size="36" :title-bold="true" :title-color="textColor">
		</u-navbar>
		<view style="padding: 0 35rpx;">
			<view class="u-border-bottom" v-for="(item, index) in commentList" :key="index">
				<view class="u-flex u-m-t-30">
					<view>
						<image :src="item.headImg" style="width: 80rpx;height: 80rpx;border-radius: 50%;" mode=""></image>
					</view>
					<view class="u-m-l-20">
						<view class="u-font-28">{{ item.nickname }}</view>
						<view>
							<text class="u-font-24 grey-color">{{ item.createdTime }}</text>
							<u-rate class="u-m-l-20" :count="count" v-model="item.score" :disabled="true" :active-color="themeColor" inactive-icon="star-fill"></u-rate>
						</view>
					</view>
				</view>
				<view style="padding: 26rpx 0;font-size: 28rpx;">
					{{ item.comment }}
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: null,
				params: {
					itemId: null,
					pageIndex: 1,
					pageSize: 20
				},
				count: 5,
				commentList: []
			}
		},
		onLoad(options) {
			this.id = options.id
			this.params.itemId = options.id
			this.getComment()
		},
		onReachBottom() {
			this.params.pageIndex++;
			this.getComment()
		},
		methods: {
			async getComment() {
				const res = await this.$http.get('api/Trade/PageTradeComment', { params: this.params })
				if (res.list.length == 0) return
				const list = res.list
				this.commentList = this.commentList.concat(list)
			}
		}
	}
</script>

<style scoped>
	page {
		background-color: #FFFFFF;
	}
</style>
